package com.sjz.han.industry.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.sjz.han.industry.R;
import com.sjz.han.industry.entities.AllRadiosEntity;
import com.sjz.han.industry.entities.TeamRadioEntity;

import java.util.ArrayList;
import java.util.List;


/**
 *图文介绍适配器
 */
public class AllTeamRadiosAdapter extends RecyclerView.Adapter<AllTeamRadiosAdapter.ViewHolder> {
    private Context context;
    public List<TeamRadioEntity.TeamRadioData.TeamRadio> datas=new ArrayList<>();
    public AllTeamRadiosAdapter(Context context) {
        this.context=context;
    }

    @Override
    public int getItemCount() {
        return datas == null ? 0 : datas.size();
    }

    public void setAdapterDatas(List<TeamRadioEntity.TeamRadioData.TeamRadio> datas){
        this.datas=datas;
        notifyDataSetChanged();
    }
    @Override
    public AllTeamRadiosAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new AllTeamRadiosAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_allradios_item, parent, false));
    }

    @Override
    public void onBindViewHolder(AllTeamRadiosAdapter.ViewHolder holder, final int position) {
       holder.guanbo_item.setText(datas.get(position).content);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView guanbo_item;
        public ViewHolder(View itemView) {
            super(itemView);
            guanbo_item=(TextView)itemView.findViewById(R.id.guanbo_item);
        }

    }
}